package com.yjetms.entity;

import com.yjetms.repository.UserRepository;

public class UserDaoImpl implements UserDao{

    UserRepository userRepository;

    User User = null;

    public UserDaoImpl(UserRepository userRepository){
        this.userRepository = userRepository;
    }

    @Override
    public User queryUserByUsername(String username) {
        User = userRepository.findByUsername(username);
        return User;
    }

    @Override
    public User queryUserByUseernameAndPassword(String username, String password) {
        User = userRepository.findByUsernameAndPassword(username,password);
        return User;
    }

    @Override
    public int saveUser(User user) {
        userRepository.save(user);
        return 0;
    }
}
